#! groovy
@Library("jenkinslib@master") _
def build = new org.devops.build()
def deploy = new org.devops.deploy()
def tools = new org.devops.tools()

def buildshell = "${env.buildShell}"
def buildtype = "${env.buildType}"
def Project_Git_Url = "${env.Project_Git_Url}"
def Project_Git_Branch = "${env.Project_Git_Branch}"

pipeline{
    agent{ node{
        label 'master'
    }}

    stages{
        stage('checkout_code'){
            steps{
                script{
                    checkout scmGit(branches: [[name: "${Project_Git_Branch}"]], extensions: [], userRemoteConfigs: [[credentialsId: '518b3d0a-24c4-4a03-82ca-a6caaf673013', url: "${Project_Git_Url}"]])
                }
            }
        }
        // clean package -DskipTests
        // clean package -Dmaven.test.skip=true
        stage("build"){
            steps{
                // dir("code/backend/tarena-tp-tea/tea-admin"){
                script{
                    tools.PrintMes("${buildtype}","green1")
                    build.Build("${buildtype}","${buildshell}")
                    tools.PrintMes(deploy.AnsibleDeploy("Jenkins_host","-m ping"),"green")
                }   
                // }
            }
        }
    }
}